package com.woniuxy.automotivemanagementsystem.controller;

import cn.hutool.crypto.digest.DigestUtil;
import com.woniuxy.automotivemanagementsystem.entity.User;
import com.woniuxy.automotivemanagementsystem.service.UserService;
import com.woniuxy.automotivemanagementsystem.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/register")
@CrossOrigin
public class RegisterController {
    @Autowired
    private UserService userService;
    @PostMapping("/register")
    public Result register(@RequestBody User  user){
        String password = DigestUtil.md5Hex(user.getPassword());
        return userService.register(user.getUsername(),password);
    }
}
